//
//  CAIViewController.m
//  CAISystemConfigManager
//
//  Created by cj on 11/01/2021.
//  Copyright (c) 2021 cj. All rights reserved.
//

#import "CAIViewController.h"
#import "CAISystemConfigManager.h"

@interface CAIViewController ()

@end

@implementation CAIViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(100, 100, 100, 100);
    btn.backgroundColor = [UIColor redColor];
    [btn setTitle:@"单key请求" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(btnAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    
    UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn2.frame = CGRectMake(210, 100, 100, 100);
    btn2.backgroundColor = [UIColor redColor];
    [btn2 setTitle:@"模块请求" forState:UIControlStateNormal];
    [btn2 addTarget:self action:@selector(btnAction2) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn2];
    
    UIButton *btn3 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn3.frame = CGRectMake(100, 210, 100, 100);
    btn3.backgroundColor = [UIColor redColor];
    [btn3 setTitle:@"取值" forState:UIControlStateNormal];
    [btn3 addTarget:self action:@selector(btnAction3) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn3];
}

-(void)btnAction{
    
    NSMutableDictionary *mapDict = [NSMutableDictionary dictionary];
    NSMutableArray *configKeyMapArray = [NSMutableArray array];
    NSArray *array = [NSArray arrayWithObjects:@"testKey1",@"testKey2",@"testKey3",nil];
    [mapDict setValue:@"default" forKey:@"moduleName"];
    [mapDict setValue:array forKey:@"key"];
    [configKeyMapArray addObject:mapDict];
    
//    [[CAISystemConfigManager shareInstance] getInstantSystemConfigKeyArray:configKeyMapArray SuccessBlock:^(NSArray * _Nonnull systemConfigArray) {
//        NSLog(@"");
//    } failureBlock:^(NSError * _Nonnull error) {
//        NSLog(@"");
//    }];

}

-(void)btnAction2{
//    [[CAISystemConfigManager shareInstance]requestSystemConfigModule:@"default" SuccessBlock:^(NSArray * _Nonnull systemConfigArray) {
//        NSLog(@"");
//    } failureBlock:^(NSError * _Nonnull error) {
//        NSLog(@"");
//    }];
}

-(void)btnAction3{
//     id getVaule = [[CAISystemConfigManager shareInstance] getSystemConfigKey:@"testKey1"];
//     NSLog(@"%@",getVaule);
//     NSLog(@"%@",getVaule);
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
